<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"
      xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>意向客户管理</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=39cd89cd">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        .lineF span {
            max-height: 140px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 7;
            text-align: left;
        }
        .lineOne {
            text-align: left;
        }

        .lineOne span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }
        .moduleName {
            float: left;
            height: 27px;
            line-height: 27px;
            font-size: 22px;
            width: 100px;
            text-align: center;
        }

        .tryStyle {
            width: 30px;
            height: 14px;
            line-height: 14px;
            font-size: 12px;
            /* top: 0; */
            right: 0;
            position: absolute;
            border-radius: 5px;
            margin-top: 1px;
            background: red;
            color: #fff;
            margin-right: -2px;
            transform: scale(0.8);
        }

        .nav-tabs-custom {
            padding: 10px;
            margin-bottom: 0;
            box-shadow: none;
            position: relative;
            overflow: hidden;
        }

        .infoReport {
            display: flex;
            justify-content: flex-start;
            text-align: left;
            margin-left: 10px;
        }

        .infoReport div {
            margin: 0 10px;
        }

        .lineOne {
            text-align: left;
        }

        .lineOne span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .lineOneNoMore {
            text-align: left;
        }

        .lineOneNoMore span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .mScrollBox {
            float: left;
            position: relative;
        }

        .imgStyle {
            width: 300px;
            height: 400px;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .templateStyle {
            border: 1px solid #ddd;
            margin-bottom: 10px;
            padding-bottom: 10px;
        }

        .table > thead > tr > th {
            padding: 0;
        }

        .table > tbody > tr > td {
            position: relative;
        }
        .table>tbody>tr>td{
            height: 30px;
            max-height: 28px;
            /*overflow: hidden;*/
        }

    </style>
</head>
<body>
<section class="content" id="app" v-cloak>
    <div class="div-td-content-more"><i></i></div>
    <!--意向客户-区域经理模块-->
    <div class="" v-if="isHasModule('intentionalCustomersPersonal')">
        <div class="nav-tabs-custom oaReportNav">
            <!-- Tabs within a box -->
            <div class="moduleName"></div>
            <div style="height: 25px;margin-bottom: 10px;">
                 <input type="text" placeholder="姓名/电话号码" class="form-control pull-left input-sm" style="width: 150px;position: absolute;left: 0px;"
                        v-model="key">
                 <button type="button" class="btn oaBtn btn-sm pull-right"   style="margin-left: 10px;height: 27px;position: absolute;left: 160px;top: 8px;"
                         @click="get_intentionalCustomersPersonal">查询
                 </button>
            </div>
        </div>
                    <div class="box-body no-padding iframeH2" style="overflow: auto;" id="intentionalCustomersPersonal">
                        <div id="progress" class="wyui-progress"></div>
                        <table class="table table-hover table-bordered text-center table-striped">
                    <thead>
                    <tr>
                        <th style="width: 40px;">序号</th>
                        <th style="width: 70px;">客户姓名</th>
                        <th style="width: 100px;">客户电话</th>
                        <th style="width: 100px;">客户类型</th>
                        <th style="width: 70px;">客户信用</th>
                        <th style="width: 100px;">客户所在地</th>
                        <th style="width: 70px;">购买时间</th>
                        <th style="width: 70px;">意向机型</th>
                        <th style="width: 70px;">购买方式</th>
                        <th style="width: 70px;">丢单状态</th>
                        <th style="width: 75px;">本月成交概率</th>
                        <th style="width: 96px;">商机确认日期</th>
                        <th> 基本情况</th>
                    </tr>
                    </thead>
                    <tbody>
                    <template v-if="intentionalCustomer.list.length>0">
                        <tr v-for="(item,i) in intentionalCustomer.list">
                            <td>{{i+1}}</td>
                            <td  @click="goDetail(item.customerId,'edit',0)" ><span style="text-align:center;color:#169BD5;cursor: pointer; ">{{item.customerName}}</span></td>
                            <td>{{item.customerTel}}</td>
                            <td>{{item.customerType}}</td>
                            <td>{{item.customerCredit}}</td>
                            <td class='td-tanZongStyle-line'><span class="lineOne"
                                                                   style="text-align: center;max-height: 24px">{{item.customerlocation}}</span>
                            </td>
                            <td>{{item.buyDate}}</td>
                            <td>{{item.needModel}}</td>
                            <td>{{item.buyType}}</td>
                            <td>
                                <span v-if="item.intentionFlag==2">是</span>
                                <span v-else="item.intentionFlag==1">否</span>
                            </td>
                            <td>
                                {{item.chance}}
                            </td>
                            <td>{{item.businessDate}}</td>
                            <td class="lineOne"><span>{{item.otherCondition}}</span></td>
                        </tr>
                    </template>
                    <template v-else>
                        <tr>
                            <td colspan="12">暂无数据</td>
                        </tr>
                    </template>
                    </tbody>
                </table>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
    <!--意向客户-大区经理模块-->
    <div class="" v-if="isHasModule('intentionalCustomersDepart')">
        <div class="nav-tabs-custom oaReportNav">
            <!-- Tabs within a box -->
            <div class="moduleName"></div>
            <button type="button" class="btn oaBtn btn-sm pull-right"
                    style="margin-left: 10px;height: 27px;position: absolute;right: 10px;top: 10px;"
                    @click="openIntentionalCustomerList()">意向客户列表
            </button>
        </div>
            <div style="padding: 0 10px;background: #fff;" id="intentionalCustomersDepart">
                <div style="width: 100%;" class="mScrollBox">
                    <table class="table table-bordered text-center table-width">
                        <thead>
                        <tr>
                            <th style="width: 8%">部门/大区</th>
                            <th style="width: 8%">岗位</th>
                            <th style="width: 8%">姓名</th>
                            <th style="width: 8%">一周内</th>
                            <th style="width: 8%">一月内</th>
                            <th style="width: 8%">一月以上</th>
                            <th style="width: 8%">数量</th>
                            <th style="width: 44%">区域</th>
                        </tr>
                        </thead>
                        <tbody>
                        <template v-if="intentionalCustomer.list.length>0">
                            <tr v-for="(item,i) in intentionalCustomer.list">
                                <td :rowspan="item.bigRegionalNamespan" :class="{hidden: item.bigRegionalNamedis}">
                                    {{item.bigRegionalName}}
                                </td>
                                <!-- :rowspan="item.roleNamespan" :class="{hidden: item.roleNamedis}"-->
                                <td >{{item.roleName}}</td>
                               <!--<td>{{item.userName}}</td>-->
                                <td @click="gotoUserDetail(item)" style="color:#169BD5;cursor: pointer;" class="openUserBox" :attrid="item.userId">{{item.regionalManagerName}}</td>
                                <template v-if="isCheck(item)&&item.weekNum!='-'">
                                    <td @click="openIntentionalCustomerList(item.regionalManagerId,true,'一周内')"
                                        style="color:#169BD5;cursor: pointer;">{{item.weekNum}}
                                    </td>
                                </template>
                                <template v-else>
                                    <td>{{item.weekNum}}
                                    </td>
                                </template>
                                <template v-if="isCheck(item)&&item.MonNum!='-'">
                                    <td @click="openIntentionalCustomerList(item.regionalManagerId,true,'一月内')"
                                        style="color:#169BD5;cursor: pointer;">{{item.MonNum}}
                                    </td>
                                </template>
                                <template v-else>
                                    <td>{{item.MonNum}}
                                    </td>
                                </template>
                                <template v-if="isCheck(item)&&item.MoreNum!='-'">
                                    <td @click="openIntentionalCustomerList(item.regionalManagerId,true,'一月以上')"
                                        style="color:#169BD5;cursor: pointer;">{{item.MoreNum}}
                                    </td>
                                </template>
                                <template v-else>
                                    <td>{{item.MoreNum}}
                                    </td>
                                </template>
                                <template v-if="isCheck(item)&&item.num!='-'">
                                    <td @click="openIntentionalCustomerList(item.regionalManagerId,true,'')"
                                        style="color:#169BD5;cursor: pointer;">{{item.num}}
                                    </td>
                                </template>
                                <template v-else>
                                    <td>{{item.num}}
                                    </td>
                                </template>
                                <td class="lineOne">
                                    <span>{{item.regionName}}</span>
                                </td>
                            </tr>
                            <tr>
                                <td>合计</td>
                                <td></td>
                                <td></td>
                                <td>{{intentionalCustomer.weekNumCount}}</td>
                                <td>{{intentionalCustomer.monNumCount}}</td>
                                <td>{{intentionalCustomer.moreNumCount}}</td>
                                <td>{{intentionalCustomer.allNumCount}}</td>
                                <td></td>
                            </tr>
                        </template>
                        <template v-else>
                            <tr>
                                <td colspan="8">暂无数据</td>
                            </tr>
                        </template>
                        </tbody>
                    </table>
                </div>
                <div class="clearfix"></div>
            </div>
    </div>

    <!--意向客户-公司级别模块-->
    <div class="" v-if="isHasModule('intentionalCustomersCompany')">
        <div class="nav-tabs-custom oaReportNav">
            <div class="moduleName"></div>
            <button type="button" class="btn oaBtn btn-sm pull-right"
                    style="margin-left: 10px;height: 27px;position: absolute;right: 10px;top: 10px;"
                    @click="openIntentionalCustomerList()">意向客户列表
            </button>
        </div>
        <div style="padding: 0 10px;background: #fff;" id="intentionalCustomersCompany">
            <div style="width: 100%;" class="mScrollBox">
                <table class="table table-bordered text-center table-width">
                    <thead>
                    <tr>
                        <!--<th style="width: 5%">序号</th>-->
                        <th style="width: 10%">公司名称</th>
                        <th style="width: 10%">部门/大区</th>
                        <th style="width: 10%">岗位</th>
                        <th style="width: 8%">姓名</th>
                        <th style="width: 8%">一周内</th>
                        <th style="width: 8%">一月内</th>
                        <th style="width: 8%">一月以上</th>
                        <th style="width: 8%">总数量</th>
                        <th style="width: 35%">区域</th>
                    </tr>
                    </thead>
                    <tbody>
                    <template v-if="intentionalCustomer.list.length>0">
                        <tr v-for="(item,i) in intentionalCustomer.list">
                            <!--<td>{{i+1}}</td>-->
                            <template v-if="item.num!=0">
                                <td :rowspan="item.companyNamespan" :class="{hidden: item.companyNamedis}">
                                    {{item.companyName}}
                                </td>
                                <td :rowspan="item.departNamespan" :class="{hidden: item.departNamedis}">
                                    {{item.departName}}
                                </td>
                                <td >{{item.roleName}}
                                </td>
                             <!--   <td @click="openIntentionalCustomerList(item.userId,true)"
                                    style="color:#169BD5;cursor: pointer;">{{item.userName}}
                                </td>-->
                                <td @click="gotoUserDetail(item)" style="color:#169BD5;cursor: pointer;" class="openUserBox" :attrid="item.userId">{{item.userName}}</td>
                                <td v-if="item.weekNum=='-'">-</td>
                                <td v-else @click="openIntentionalCustomerList(item.userId,true,'一周内')"
                                    style="color:#169BD5;cursor: pointer;">{{item.weekNum}}
                                </td>
                                <td v-if="item.MonNum=='-'">-</td>
                                <td v-else @click="openIntentionalCustomerList(item.userId,true,'一月内')"
                                    style="color:#169BD5;cursor: pointer;">{{item.MonNum}}
                                </td>
                                <td v-if="item.MoreNum=='-'">-</td>
                                <td v-else @click="openIntentionalCustomerList(item.userId,true,'一月以上')"
                                    style="color:#169BD5;cursor: pointer;">{{item.MoreNum}}
                                </td>
                                <td v-if="item.num=='-'">-</td>
                                <td v-else @click="openIntentionalCustomerList(item.userId,true,'')"
                                    style="color:#169BD5;cursor: pointer;">{{item.num}}
                                </td>
                                <td class="lineOne">
                                    <span>{{item.regionName}}</span>
                                </td>
                            </template>
                        </tr>
                        <tr>
                            <td>合计</td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td>{{intentionalCustomer.weekNumCount}}</td>
                            <td>{{intentionalCustomer.monNumCount}}</td>
                            <td>{{intentionalCustomer.moreNumCount}}</td>
                            <td>{{intentionalCustomer.allNumCount}}</td>
                            <td></td>
                        </tr>
                    </template>
                    <template v-else>
                        <tr>
                            <td colspan="8">暂无数据</td>
                        </tr>
                    </template>
                    </tbody>
                </table>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
    <!--意向客户-集团级别模块-->
    <div class="" v-if="isHasModule('intentionalCustomersGroup')">
        <!--<div class="nav-tabs-custom oaReportNav">-->
            <!--&lt;!&ndash; Tabs within a box &ndash;&gt;-->
            <!--<div class="moduleName"></div>-->
            <!--<button type="button" class="btn oaBtn btn-sm pull-right"-->
                    <!--style="margin-left: 10px;height: 27px;position: absolute;right: 10px;top: 10px;"-->
                    <!--@click="openIntentionalCustomerList()">意向客户列表-->
            <!--</button>-->
        <!--</div>-->
        <div style="padding: 0 10px;background: #fff;" id="intentionalCustomersGroup">
            <div style="width: 100%;" class="mScrollBox">
                <table class="table table-bordered text-center table-width" style="width: 650px;margin: 0 auto;">
                        <thead>
                    <tr>
                        <!--<th style="width: 5%;">序号</th>-->
                        <th style="width: 50px;">公司名称</th>
                        <th style="width: 50px;">一周内</th>
                        <th style="width: 50px;">一月内</th>
                        <th style="width: 50px;">一月以上</th>
                        <th style="width: 50px;">总数量</th>
                    </tr>
                    </thead>
                    <tbody>
                    <template v-if="intentionalCustomer.list.length>0">
                        <tr v-for="(item,i) in intentionalCustomer.list">
                            <!--<td>{{i+1}}</td>-->
                            <td @click="openIntentionalCustomersDepart(item.companyId)"
                                style="color:#169BD5;cursor: pointer;">{{item.companyName}}
                            </td>
                            <td>{{item.weekNum}}
                            </td>
                            <td>{{item.MonNum}}
                            </td>
                            <td>{{item.MoreNum}}
                            </td>
                            <td>{{item.num}}
                            </td>
                        </tr>
                        <tr>
                            <td>合计</td>
                            <td>{{intentionalCustomer.weekNumCount}}</td>
                            <td>{{intentionalCustomer.monNumCount}}</td>
                            <td>{{intentionalCustomer.moreNumCount}}</td>
                            <td>{{intentionalCustomer.allNumCount}}</td>
                        </tr>
                    </template>
                    <template v-else>
                        <tr>
                            <td colspan="5">暂无数据</td>
                        </tr>
                    </template>
                    </tbody>
                </table>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=558d0414"></script>

<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script src="/dist/plugins/select2/select2.full.min.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script>
    $.extend($.wyui, {
        postMethod: function (url, data, callback, sync, id) {
            if (!id) {
                id = "#app"
            }
            $.ajax({
                url: server.ip + url,
                async: sync ? false : true,
                data: JSON.stringify(data),
                beforeSend: function () {
                    App.blockUI({
                        target: id,
                        boxed: true,
                        message: '加载中......'//,
                        // animate: true
                    });
                },
                complete: function () {
                    setTimeout(function () {
                        App.unblockUI(id);
                    }, 1000);

                },
                success: function (r) {
                    if (!r.e.code) {
                        callback(r.data.sendData);
                    } else {
                        alert(r.e.desc);
                    }
                },
                error: function (e) {
                    console.log(url + e.responseText);
                    App.unblockUI('#app');
                }
            });
        },
    });
</script>
<script type="text/javascript">
    function refresh() {
       // app.getModules();
        //3.通过拥有的模块调用各模块对应的接口
        app.getFunctionByTemplate();

    }
    $(function () {
        $("body").on("click", ".lineOne,.lineTwo,.lineF", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });

    var app = new Vue({
        el: '#app',
        data: {
            userId: getCurrentUser().id,
            roleName:getCurrentUser().roleName,
            companyId: getCurrentUser().companyId,
            frontFlag: getCurrentUser().frontFlag,
            departId: getCurrentUser().departId,
            modules: [],//该人员拥有的模块列表,
            reginIds: [],//该人员拥有的区域列表ID
            regionNames: [],//该人员拥有的区域列表名称
            yesterday: new Date(new Date() - 24 * 60 * 60 * 1000).Format("yyyy-MM-dd"),
            today: new Date().Format("yyyy-MM-dd"),//今天
            hour: new Date().getHours(),
            thisMonth: new Date().Format("yyyy-MM"),
            thisWeek: new Date().Format("yyyy-MM-dd") + "-w",
            tab: [],
            list: [],
            key:'',
            intentionalCustomer: {
                id: '',
                name: '',
                tel: '',
                wechat: '',
                birthday: '',
                idCard: '',
                provinceName: '',
                cityName: '',
                countyName: '',
                source: '',
                intentionModel: '',
                buyType: '',
                fundCondition: '',
                existingDevice: '',
                OtherCondition: '',
                time: new Date().Format("yyyy-MM-dd"),
                list: [],
                weekNumCount:'',
                monNumCount:'',
                moreNumCount:'',
                allNumCount:'',
                customerName:'',
                throwFlag:'',
                throwReason:'',
                intentionFlag:''
            },
        },

        methods: {
            gotoUserDetail: function (item) {
                top.$.dialog({
                    content: 'url:/page/personnel/entry.html?id=' + item.userId+ '&pageType=look',
                    title: item.userName + "详情",
                    width: 904,
                    height: 613,
                    max: true,
                    min: true,
                    lock: true
                }).max();
            },
            goDetail:function (customerId,pageType,isAdd) {
                var that=this;
                var H = $(window).height()-50;
                if (isAdd==1){
                    customerId="0";
                    that.userId= getCurrentUser().id;
                }else {
                    if ( !((that.userId)==(getCurrentUser().id)) ){
                        pageType='look';
                    }
                }

                $.dialog({
                    content: 'url:detail.html?pageType='+pageType+"&customerId="+customerId+"&userId="+getCurrentUser().id+"&isAdd="+isAdd,
                    title: '意向客户详情',
                    width: 400,
                    height: H,
                    max: true,
                    min: true,
                    lock: true
                });
            },

            //打开意向客户列表
            openIntentionalCustomerList: function (userId,type,key) {
                var that = this;
                var isAll = true;
                if (type) {
                    isAll = false;
                }
                if (!userId) {
                    userId = this.userId
                }
                if (!key) {
                    key="";
                }
                top.closeTabByPageId("openIntentionalCustomerList");
                top.addTabs({
                    id: 'openIntentionalCustomerList',
                    title: '意向客户列表',
                    close: true,
                    url: 'intentCustomerReportNew/intentionalCustomerList.html?userId=' + userId + '&isAll=' + isAll+'&key=' + key
                });
            },
            //打开公司意向客户列表
            openIntentionalCustomersDepart: function (companyId, type) {
                var that = this;
                if (!companyId) {
                    companyId = this.companyId
                }
                var that = this;
                top.closeTabByPageId("openIntentionalCustomersDepart");
                top.addTabs({
                    id: 'openIntentionalCustomersDepart',
                    title: '意向客户管理',
                    close: true,
                    url: 'intentCustomerReportNew/intentionalCustomerDepart.html?companyId=' + companyId
                });
            },
            trustTrialFlag2Name:function (flage) {
                if (flage == 1){return "已通过";}
                else if (flage == 2) {return "已驳回";}
                else if (flage == 0) {return "待审核";}
                else{return "-";}
            },
            showABtn: function (item, btnName) {
                switch (btnName) {
                    case 'browser':
                        switch (item.auditFlag) {
                            case -1:
                                return false;
                                break;
                            case 0:
                                return currentUser.id != item.currentAuditorId;
                                break;
                            case 1:
                            case 2:
                                return true;
                                break;
                        }
                        return true;
                        break;
                    case 'edit':
                        return item.auditFlag == -1 && item.createUserId == currentUser.id;
                        break;
                    case 'audit':
                        return item.auditFlag == 0 && currentUser.id == item.currentAuditorId;
                        break;
                    default:
                        break;
                }
            },
            showBtn: function (btnName) {
                switch (btnName) {
                    case "submitPay":
                        return this.pageType == 'pay' && ($.inArray('submitPay', this.rightOpENames) > -1);
                        break;
                    case "addApply":
                        return this.pageType == 'apply';
                        break;
                    case "payAudit":
                        if (this.pageType == 'apply') {
                            return false;
                        }
                        var result = false;
                        for (var i = 0; i < this.list.length; i++) {
                            if (this.list[i].currentAuditorId == getCurrentUser().id) {
                                result = true;
                                break;
                            }
                        }
                        return result;
                        break;
                    default:
                        break;
                }
            },

            isHasModule: function (moduleEName) {
                return $.inArray(moduleEName, this.modules) > -1;
            },
            //获取个人意向客户列表
            get_intentionalCustomersPersonal: function () {
                var that = this;
                $.wyui.postMethod(urlConfig.report.intentCustomerFromBusiness.getForPersonalIntentCustomerList, {
                    "userId": that.userId,"key":that.key
                }, function (data) {
                    console.log(data);
                    var data = trimRN2(data);
                    that.intentionalCustomer.list = data.records;
                }, false, "#intentionalCustomersPersonal");

            },

            //获取大区意向客户报表
            get_intentionalCustomersDepart: function (id) {
                var that = this;
                    var that = this;
                    $.wyui.postMethod(urlConfig.report.intentCustomerFromBusiness.getForDepartIntentCustomerList, {
                        "userId": that.userId
                    }, function (data) {
                        console.log(data);
                        var data = trimRN2(data);
                        that.intentionalCustomer.list = that.tablesMergeCell(data);
                        that.intentionalCustomer.weekNumCount = that.getCount( that.intentionalCustomer.list, "weekNum");
                        that.intentionalCustomer.monNumCount = that.getCount( that.intentionalCustomer.list, "MonNum");
                        that.intentionalCustomer.moreNumCount = that.getCount( that.intentionalCustomer.list, "MoreNum");
                        that.intentionalCustomer.allNumCount = that.getCount( that.intentionalCustomer.list, "num");
                    }, false, "#get_intentionalCustomersDepart");

            },
            //获取公司意向客户报表
            get_intentionalCustomersCompany: function () {
                var that = this;
                $.wyui.postMethod(urlConfig.report.intentCustomerFromBusiness.getForCompanyIntentCustomerList, {
                    "userId": that.userId
                }, function (data) {
                    console.log(data);
                    var data = trimRN2(data);
                    that.intentionalCustomer.list = that.tablesMergeCell(data);
                    that.intentionalCustomer.weekNumCount = that.getCount( that.intentionalCustomer.list, "weekNum");
                    that.intentionalCustomer.monNumCount = that.getCount( that.intentionalCustomer.list, "MonNum");
                    that.intentionalCustomer.moreNumCount = that.getCount( that.intentionalCustomer.list, "MoreNum");
                    that.intentionalCustomer.allNumCount = that.getCount( that.intentionalCustomer.list, "num");
                }, false, "#get_intentionalCustomersCompany");
            },
            //获取集团意向客户报表
            get_intentionalCustomersGroup: function () {
                var that = this;
                $.wyui.postMethod(urlConfig.report.intentCustomerFromBusiness.getForGroupIntentCustomerList, {
                    "userId": that.userId
                }, function (data) {
                    console.log(data);
                    var data = trimRN2(data);
                    that.intentionalCustomer.list = that.tablesMergeCell(data);
                    that.intentionalCustomer.weekNumCount = that.getCount( that.intentionalCustomer.list, "weekNum");
                    that.intentionalCustomer.monNumCount = that.getCount( that.intentionalCustomer.list, "MonNum");
                    that.intentionalCustomer.moreNumCount = that.getCount( that.intentionalCustomer.list, "MoreNum");
                    that.intentionalCustomer.allNumCount = that.getCount( that.intentionalCustomer.list, "num");
                }, false, "#get_intentionalCustomersGroup");
            },
            //获取modules
            getModules: function () {
                var that = this;
                $.wyui.postMethod( urlConfig.report.config.module.getModuleENamesByUserId, {userId: getCurrentUser().id}, function (data) {
                    var eNames = [];
                    for (var i = 0; i < data.length; i++) {
                        if(data[i].appTodayReport=='0'){
                            eNames.push(data[i].eName);
                        }
                    }
                    that.modules = eNames;
                    console.log(that.modules)
                }, true);
            },
            //通过拥有的模块调用各模块对应的接口
            getFunctionByTemplate: function () {
                var that = this;
                for (var i = 0; i < that.modules.length; i++) {
                    /* if (that.modules[i] == "signInPersonal") {
                     //大区经理-考勤和区域经理考勤初始时间不一样。所以特定调整一下；
                     that.sign.time = that.thisMonth;
                     }*/
                    console.log(that.modules[i])
                    if (that["get_" + that.modules[i]]) {
                        if (that.modules[i] == 'costDepart') {
                            that.get_costPersonal()
                        } else {
                            that["get_" + that.modules[i]]();

                        }
                    }

                }
            },
            getRegionByUserId: function () {
                var that = this;
                $.wyui.postMethod(urlConfig.report.visitCustomer.getRegionByUserId, {userId: getCurrentUser().id}, function (ids) {
                    for (var i = 0; i < ids.length; i++) {
                        that.reginIds.push(ids[i].regionId);
                    }
//                    console.log(that.reginIds)
                }, true);
            },
            //合并单元格
            tablesMergeCell: function (list) {
                for (field in list[0]) {
                    var k = 0;
                    while (k < list.length) {
                        list[k][field + 'span'] = 1;
                        list[k][field + 'dis'] = false;
                        for (var i = k + 1; i <= list.length - 1; i++) {
                            if (list[k][field] == list[i][field] && list[k][field] != '') {
                                list[k][field + 'span']++;
                                list[k][field + 'dis'] = false;
                                list[i][field + 'span'] = 1;
                                list[i][field + 'dis'] = true;
                            } else {
                                break;
                            }
                        }
                        k = i;
                    }
                }
                return list;
            },
            //获取合计
            getCount: function (arr, key) {
                var number = 0;
                for (var i = arr.length - 1; i >= 0; i--) {
                    number += (arr[i][key] && arr[i][key] != '-' ? arr[i][key] : 0)

                }
                return number;
            },
            isCheck: function (item) {
                var that = this;
                if (that.isHasRightOp(item.regionId)) {
                    return true
                }  else if (item.regionId==''){
                    return true;
                }
                else {
                    return false
                }
            },
            isHasRightOp: function (regionId) {
                //console.log($.inArray(regionId, this.reginIds) > -1)
                return $.inArray(regionId, this.reginIds) > -1;
            },
        },
        mounted: function () {
            console.log(getCurrentUser().roleName);
            var that = this;
            this.getModules();
            //3.通过拥有的模块调用各模块对应的接口
            this.getFunctionByTemplate();
            this.getRegionByUserId();
        }
    });


</script>
</body>
</html>